#include <stdio.h>
int main()
{
    int n,a[56],t,i;
    a[0]=1;a[1]=1;
    while (scanf("%d",&n)!=EOF)
    {
        t=1;
        if (n==0)break;
        for (i=2;i<=n;i++)
        {
            if (i<=4)t++;
            else t=t+a[i-3];
            a[i]=t;
        }
        printf("%d\n",a[n]);
    }
    return 0;
}